import React from 'react'
import axios from 'axios'
import FilmItem from './FilmItem';
import FilmDetail from './FilmDetail';
export default class App extends React.Component{
    constructor(){
        super()
        this.state={
            filmList:[],
            content:'lalal'
        }
        axios.get('/07test.json').then(res=>this.setState({filmList:res.data}))
    }
    render(){
        return(
            <div>
                {
                    this.state.filmList.map(item=>
                        <FilmItem {...item} handlePick={(content)=>{
                            this.setState({
                                content
                            })
                        }}/>
                    )
                }
                <FilmDetail content={this.state.content}/>
            </div>
        )
    }
} 